package com.mubolg.controller.app;

import cn.dev33.satoken.annotation.SaIgnore;
import com.mubolg.result.R;
import com.mubolg.service.ICustomerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

@Tag(name = "小程序乘客对象",description = "小程序乘客对象")
@RestController
@RequestMapping("/app/customer")
public class AppCoustomerController {
    @Autowired
    private ICustomerService customerService;

    //获取对象
    @Operation( summary= "小程序乘客注册",description = "小程序乘客注册接口")
    @Parameter(name = "openIdCode",description = "获取openId的code",required = true)
    @GetMapping("/register/{openIdCode}/{phoneCode}")
    @SaIgnore
    public R get(@PathVariable("openIdCode") @NotNull(message = "参数不能为空") String openIdCode,@PathVariable("phoneCode") @NotNull(message = "参数不能为空") String phoneCode) throws Exception {
        customerService.register(openIdCode,phoneCode);
        return R.success();
    }


}
